local liaoyuan = fk.CreateSkill {

  name = "joy__liaoyuan",

  tags = {  },

}



liaoyuan:addEffect("active", {
  name = "joy__liaoyuan",
    anim_type = "offensive",
    card_filter = Util.FalseFunc,
    target_filter = Util.FalseFunc,
    target_num = 0,
    card_num = 0,
    can_use = function(self, player)
        return   player:usedSkillTimes(liaoyuan.name, Player.HistoryPhase) == 0 and  not player:prohibitUse(Fk:cloneCard("fire_attack"))
      end,
    on_use = function(self, room, effect)
      local player = effect.from
      U.askForUseVirtualCard(room, player, "fire_attack", nil, liaoyuan.name)
    end,
})

liaoyuan:addEffect(fk.CardUsing, {
  name = "#joy__liaoyuan_trigger",
    anim_type = "offensive",
    events = {fk.CardUsing},
    mute = true,
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(liaoyuan.name) and data.card.name == "fire_attack"
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local targets = data:getUseExtraTargets()
      local n = #targets
      if n == 0 then return false end
      local tos = room:askForChoosePlayers(player, targets, 1, n, "#joy__liaoyuan-choose:::"..data.card:toLogString(), liaoyuan.name, true)
      if #tos > 0 then
        table.forEach(tos, function (id)
          table.insert(data.tos, {id})
        end)
      end
    end,
})

liaoyuan:addEffect("targetmod", {
  name = "#joy__liaoyuan_targetmod",
    extra_target_func = function(self, player, skill, card)
      if card and card.name == "fire_attack"   then
        return 999
      end
    end,
})

return liaoyuan